#include <REGX52.h>
#include <INTRINS.h>
#include "MatrixLED.h"

//动画的十六进制编码
unsigned char Hello_Animation[] = {
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
		0x15,0x0D,0x00,0xFE,0x01,0x02,0x00,0xFE,
		0x01,0x02,0x00,0x06,0x09,0x09,0x06,0x00,
		0xFD,0x00,0xFD,0x00,0xFD,0x00,0xFD,0x00,
		0x00,0x00,0x00,0x00,0x00};
unsigned char Change_Face[] = {
		0x3C,0x42,0xA9,0x85,0x85,0xA9,0x42,0x3C,
		0x3C,0x42,0xA9,0x89,0x89,0xA9,0x42,0x3C,
		0x3C,0x42,0xA5,0x89,0x89,0xA5,0x42,0x3C,
		0x3C,0x42,0xA9,0x89,0x89,0xA9,0x42,0x3C,
};
/**
  * @brief		显示Hello!!!!动画
  * @parm		无
  * @retval		无
  */
void ShowHelloAnimation()
{
	int i, j;
	for(i = 0; i < 39; ++i)
	{
		//一帧要显示多遍
		int count = 10;
		while(count--)
		{
			for(j = 0; j < 8; ++j)
			{
				MatrixLED_ShowColumn(j, Hello_Animation[i + j]);
			}
		}
	}
}

/**
  * @brief		显示笑脸哭脸切换动画
  * @parm		无
  * @retval		无
  */
void ShowChangeFaceAnimation()
{
	int i, j;
	for(i = 0; i < 25; i += 8)
	{
		//一帧要显示多遍
		int count = 50;
		while(count--)
		{
			for(j = 0; j < 8; ++j)
			{
				MatrixLED_ShowColumn(j, Change_Face[i + j]);
			}
		}
	}
}
	

							 
void main()
{
	MatrixLED_Init();
    while(1)
    {
		ShowHelloAnimation();
		//ShowChangeFaceAnimation();
    }
}